import Vue from 'vue';
import VueRouter from 'vue-router';
import home from '@/components/home/home';
import userCenter from '@/components/user/userCenter';
//news表示周边商品
import newsItems from '@/components/home/newsItems';
import addNews from '@/components/home/addNews';
import newsDetail from '@/components/news/newsDetail';
//articles表示分享
import articles from '@/components/recommend/articles';
import addArticles from '@/components/recommend/addArticles';

Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    name: 'home',
    component: home,
    redirect:{name: 'newsItems'},//重定向
    children:[
      {
        path:'music',
        name:'newsItems',
        component:newsItems,
        props: true//
      },
      {
        path:'movie',
        name:'newsItems',
        component:newsItems,
        props: true//
      },
      {
        path:'book',
        name:'newsItems',
        component:newsItems,
        props: true//
      },
      {
        path:'/addNews',
        name:'addNews',
        component:addNews
      }
    ]
  },
  {
    path:'/user/userCenter',
    name:'userCenter',
    component:userCenter
  },
  // 某商品详情页
  {
    path:'/news/id/:id',
    name:'newsDetail',
    component:newsDetail
  },
  {
    path:'/recommend/musicWorld',
    name:'articles',
    component:articles,
    //props: true//
  },
  {
    path:'/recommend/movieWorld',
    name:'articles',
    component:articles,
    //props: true//
  },
  {
    path:'/recommend/bookWorld',
    name:'articles',
    component:articles,
    //props: true//
  },
  {
    path:'/recommend/addArticles',
    name:'addArticles',
    component:addArticles
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
